package com.justonetech.db.domain.base;

import com.justonetech.db.domain.ExamClass;

import java.io.Serializable;


/**
 * This is an object that contains data related to the EXAM_STUDENT table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 * TableComment : 学生
 * SyncTemplatepatterns : list\w*
 * SyncDao : false
 * TableName : 学生
 * SyncBoolean : get
 * SyncJsp : true
 * Treeable : false
 * SubSystem : exam
 * Projectable : false
 *
 * @hibernate.class
 *  table="EXAM_STUDENT"
 */

public abstract class BaseExamStudent  implements Serializable {

	public static String REF = "ExamStudent";
	public static String PROP_NAME = "name";
	public static String PROP_BORN_DATE = "bornDate";
	public static String PROP_CLASS = "examClass";
	public static String PROP_ID = "id";
	public static String PROP_CODE = "code";
	public static String PROP_SEX = "sex";


	// constructors
	public BaseExamStudent () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseExamStudent (java.lang.Long id) {
		this.setId(id);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.Long id;

	// fields
    /*BORN_DATE*/
    /*出生日期*/
	private java.sql.Date bornDate;
	
    /*CODE*/
    /*学号*/
	private java.lang.Integer code;
	
    /*NAME*/
    /*姓名*/
	private java.lang.String name;
	
    /*SEX*/
    /*性别(1男/2女)*/
	private java.lang.Integer sex;
	

	// many to one
	private com.justonetech.db.domain.ExamClass examClass;

	// collections
	private java.util.Set<com.justonetech.db.domain.ExamSc> examScs;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="com.justonetech.core.orm.hibernate.LongIdGenerator"
     *  column="ID"
     */
	public java.lang.Long getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 * @deprecated
	 */
	public void setId (java.lang.Long id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: BORN_DATE
	 */
	public java.sql.Date getBornDate () {
		return bornDate;
	}

	/**
	 * Set the value related to the column: BORN_DATE
	 * @param bornDate the BORN_DATE value
	 */
	public void setBornDate (java.sql.Date bornDate) {
		this.bornDate = bornDate;
	}


	/**
	 * Return the value associated with the column: CODE
	 */
	public java.lang.Integer getCode () {
		return code;
	}

	/**
	 * Set the value related to the column: CODE
	 * @param code the CODE value
	 */
	public void setCode (java.lang.Integer code) {
		this.code = code;
	}


	/**
	 * Return the value associated with the column: NAME
	 */
	public java.lang.String getName () {
		return name;
	}

	/**
	 * Set the value related to the column: NAME
	 * @param name the NAME value
	 */
	public void setName (java.lang.String name) {
		this.name = name;
	}


	/**
	 * Return the value associated with the column: SEX
	 */
	public java.lang.Integer getSex () {
		return sex;
	}

	/**
	 * Set the value related to the column: SEX
	 * @param sex the SEX value
	 */
	public void setSex (java.lang.Integer sex) {
		this.sex = sex;
	}


    public ExamClass getExamClass() {
        return examClass;
    }

    public void setExamClass(ExamClass examClass) {
        this.examClass = examClass;
    }

    /**
	 * Return the value associated with the column: examScs
	 */
	public java.util.Set<com.justonetech.db.domain.ExamSc> getExamScs () {
		if(examScs == null){
			examScs = new java.util.LinkedHashSet<com.justonetech.db.domain.ExamSc>();
		}
		return examScs;
	}

	/**
	 * Set the value related to the column: examScs
	 * @param examScs the examScs value
	 */
	public void setExamScs (java.util.Set<com.justonetech.db.domain.ExamSc> examScs) {
		this.examScs = examScs;
	}

	public void addToexamScs (com.justonetech.db.domain.ExamSc examSc) {
		if (null == getExamScs()) setExamScs(new java.util.LinkedHashSet<com.justonetech.db.domain.ExamSc>());
		getExamScs().add(examSc);
	}



	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.justonetech.db.domain.ExamStudent)) return false;
		else {
			com.justonetech.db.domain.ExamStudent examStudent = (com.justonetech.db.domain.ExamStudent) obj;
			if (null == this.getId() || null == examStudent.getId()) return false;
			else return (this.getId().equals(examStudent.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		org.apache.commons.lang.builder.ToStringBuilder builder = new org.apache.commons.lang.builder.ToStringBuilder(this);
		builder.append(id);
		builder.append(bornDate);
		builder.append(code);
		builder.append(name);
		builder.append(sex);
		return builder.toString();
	}


}